var n1=286,n2=2,n3=2;

var getT=function() {
    n1++;
    return n1*(n1+1)/2
}

var getP=function() {
    n2++;
    return n2*(3*n2-1)/2
}

var getH=function() {
    n3++;
    return n3*(2*n3-1)
}

var t1, t2, t3, t;
t1 = getT();
t2 = getP();
t3 = getH();
while(t1!=t2 || t2!=t3) {
    t = Math.min(t1,t2,t3);
    if(t1==t) t1= getT();
    if(t2==t) t2= getP();
    if(t3==t) t3= getH();
    print(n1 + "," + n2 + "," + n3);
}
print(t1); 
